<?php

use Drupal\shusy_team\Entity\ShusyTeam;

function shusy_team_shusy_team_add_page() {
  $e = new ShusyTeam();
  module_load_include('inc', 'shusy_team', 'shusy_team.forms');
  return drupal_get_form('shusy_team_shusy_team_entity_form', $e, 'add');
}

function shusy_team_shusy_team_view_page(ShusyTeam $e) {
  return entity_view($e->entityType(), [$e]);
}

function shusy_team_shusy_team_edit_page(ShusyTeam $e) {
  module_load_include('inc', 'shusy_team', 'shusy_team.forms');
  return drupal_get_form('shusy_team_shusy_team_entity_form', $e, 'edit');
}

function shusy_team_shusy_team_delete_page(ShusyTeam $e) {
  module_load_include('inc', 'shusy_team', 'shusy_team.forms');
  return drupal_get_form('shusy_team_shusy_team_delete_form', $e);
}

function shusy_team_mini_qr_add_page() {
  $uri = wx_mini_qr_create('shusy_team', 'shusy_team', 'teamApply', [
    'width' => 300,
    'line_color' => ['r' => 255, 'g' => 0, 'b' => 0],
  ]);
  return format_string("<img src='@src' width='300'>", ['@src' => file_create_url($uri)]);
}

function shusy_team_clear_page() {
  module_load_include('inc', 'shusy_team', 'shusy_team.forms');
  return drupal_get_form('shusy_team_clear_form');
}
